package flash.display
{
	public class DisplayObjectContainer extends InteractiveObject
	{
		public function DisplayObjectContainer()
		{
			super();
		}
		protected var _mouseChildren:Boolean = true;
		public function set mouseChildren(value:Boolean):void
		{
			_mouseChildren = value;
			changePropertys["mouseChildren"] = value;
		}
		public function get mouseChildren():Boolean
		{
			return _mouseChildren;
		}
		protected var children:Array = new Array();
		public function get numChildren():int
		{
			return children.length;
		}
		public function addChild(child:DisplayObject):void
		{
			child.setParent(this);
			children.push(child);
		}
		
		protected override function onAddedToStage():void
		{
			super.onAddedToStage();
			for(var i:int = 0; i < children.length; i++) 
			{
				children[i].setStage(stage);//设置子元件的stage
			}
		}
		public override function render():void
		{
			renderChildren();
			renderMouseChildren();
			super.render();
		}
		protected function renderChildren():void
		{
			for(var i:int = 0; i < children.length; i++) 
			{
				children[i].render();
			}
		}
		protected function renderMouseChildren():void
		{			
			if(changePropertys["mouseChildren"])
			{
				for(var i:int = 0; i < children.length; i++) 
				{
					if(children[i].mouseEnabled)
					{
						children[i].mouseEnabled = mouseChildren;
					}
				}
			}
		}
		protected override function renderAlpha():void
		{
			super.renderAlpha();
		}
		
	}
}